core.osgi

Provides utility functions for retrieving, registering and removing OSGi services.

core.osgi.get_service(class_or_name)

This function gets the specified OSGi service.

Parameters

class_or_name (class or str) – the class or class name of the service to get

Returns

the requested OSGi service or None

Return type

OSGi service or None

core.osgi.find_services(class_name, filter)

This function finds the specified OSGi service.

Parameters
  • class_or_name (class or str) – the class or class name of the service to get

  • filter (str) – the filter expression or None for all services

Returns

a list of matching OSGi services

Return type

list

core.osgi.register_service(service, interface_names, properties=None)

This function registers the specified service object with the specified properties under the specified class names into the Framework.

Parameters
  • service (java.lang.Object) – the service to register

  • interface_names (list) – a list of class names

  • properties (dict) – a dict of properties for the service

Returns

a ServiceRegistration object used to update or unregister the service

Return type

ServiceRegistration

core.osgi.unregister_service(service)

This function unregisters an OSGi service.

Parameters

service (java.lang.Object) – the service to unregister